<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
use mdm\admin\components\Helper;

/* @var $this yii\web\View */
/* @var $model common\models\System */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common', 'system'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="system-view">
    <p>
        <?php
        if(Helper::checkRoute('create')) {
        ?>
        <?= Html::a(Yii::t('common', 'create'), ['create'], ['class' => 'btn btn-primary']) ?>
        <?php
        }
        if(Helper::checkRoute('update')) {
        ?>
        <?= Html::a(Yii::t('common', 'update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?php
        }
        if(Helper::checkRoute('delete')) {
        ?>
        <?= Html::a(Yii::t('common', 'delete'), ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => Yii::t('common', 'Are you sure you want to delete this item?'),
                'method' => 'post',
            ],
        ]) ?>
        <?php
        }
        ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            //'id',
            'name',
            'code',
            'value',
            ['label' => Yii::t('common', 'status'), 'value' => \common\helpers\TStringHelper::getStatusText($model->status)],
            ['label' => Yii::t('common', 'created_at'), 'value' => \common\helpers\TStringHelper::ShowDate($model->created_at)],
            ['label' => Yii::t('common', 'updated_at'), 'value' => \common\helpers\TStringHelper::ShowDate($model->updated_at)],
        ],
    ]) ?>

</div>
